package org.kzwl.book.controller.app;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.kzwl.comm.pojo.ResponseData;
import org.kzwl.comm.pojo.bo.interaction.InteractionAddBO;
import org.kzwl.comm.pojo.bo.interaction.InteractionBasicBO;
import org.kzwl.comm.pojo.dto.interaction.InteractionBasicDTO;
import org.kzwl.service.web.CuInteractionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/app-interaction")
@Api("互动空间")
public class InteractionController {

    @Autowired
    private CuInteractionService interactionService;

    @ApiOperation(value = "互动空间查询",notes = "只需要填分页参数")
    @PostMapping("/queryBasic")
    public ResponseData<List<InteractionBasicDTO>> queryBasic(@RequestBody InteractionBasicBO bo){
        bo.setCuTownId(0);
        IPage<InteractionBasicDTO> page =  interactionService.queryBasic(bo);
        return new ResponseData<>(page.getRecords());
    }

    @ApiOperation(value = "互动空间发布",notes = "场馆id不用填")
    @PostMapping("/insert")
    public ResponseData<Void> insert(@RequestBody InteractionAddBO bo){
        bo.setCuInteractionTownId(0);
        interactionService.insertInteraction(bo);
        return new ResponseData<>();
    }

}
